Bits.DLL was created to add some much need bit and byte-wise operands to my Visual Basic applications ... they weren't hard to write, but they did involve an investment in some serious technology (including Borland C++ 3.0 Professional, Visual Basic and assorted books). So here's the poop. If you use these for your own personal, non-commercial use ... it's freeware. If you're incorporating these routines in a commercial product, be it over-the-counter, mail-order, shareware etc ... it requires my written perssion depending on the scope of the product (though I figure any big-time operation is probably going to write their own) ... in most cases it'll be a swap with the shareware author, or a very nominal fee. If there is an interest in these, I'll expand them, and will create other dynamic link libraries as well (e.g. string handlers, quick sorts and other low-level nasties that take a bazillion lines of BASIC to every one or two lines of C or C++). Here's how you reach me : Slow way : Constantine Peters 14409 Briarwood Terrace Rockville, MD 20853 Here's the fast way : ENIAC MIDI BBS, Constantine Peters Sysop (convenient ain't it ?) (301)460-9134, FidoNet/Node 109/440, 9600bps USR HST, 24hrs Here are the current functions as of this release ..... ------------------------- ByteHigh --------------------------- Usage : Declare Function ByteHigh Lib "BITS.DLL" (ByVal e1%) As Integer i% = ByteHigh(e1%) Parameters : Integer e1% Return Value: Integer - Most significant/High order bit of e1% Comments : See Also : ByteLow, BitShiftLeft ------------------------- ByteLow --------------------------- Usage : Declare Function ByteLow Lib "BITS.DLL" (ByVal e1%) As Integer i% = ByteLow(e1%) Parameters : Integer e1% Return Value: Integer - Least significant/Low order bit of e1% Comments : See Also : ByteHigh, BitOr ------------------------- BitPack --------------------------- Usage : Declare Function BitPack Lib "BITS.DLL" (ByVal eHi%, ByVal eLo%) As Integer i% = BitPack(eHi%, eLo%) Parameters : Integer eHi% - High Order (Most Significant) Byte Integer eLo% - Low Order (Least Significant) Byte Return Value: Integer - combined or "packed" value of High & Lo order bytes Comments : The term "Bit Packing" actually refers to packing two bytes in most modern instances, however, this old term has stuck. Don't let it confuse you, we're packing two bytes. See Also : ByteHigh, BitLow ------------------------- BitAnd --------------------------- Usage : Declare Function BitAnd Lib "BITS.DLL" (ByVal e1%, ByVal e2%) As Integer i% = BitAnd(e1%, e2%) Parameters : Integer e1% - exponent 1, number to AND Integer e2% - mask, number to AND against e1% Return Value: Integer - e2% AND masked against e1% Comments : 1 AND 1 = 1 (true) 1 AND 0 = 0 (false) 0 AND 0 = 1 (true) 0 AND 1 = 0 (false) I realize most true and false in BASIC is -1 for True and 0 for False, but I will use this DLL in other languages such as Actor 4.0 See Also : BitOr, BitXOr ------------------------- BitOr --------------------------- Usage : Declare Function BitOr Lib "BITS.DLL" (ByVal e1%, ByVal e2%) As Integer i% = BitOr(e1%, e2%) Parameters : Integer e1% - exponent 1, number to Or Integer e2% - mask, number to OR against e1% Return Value: Integer - e2% OR masked against e1% Comments : 1 OR 1 = 1 (true) 1 OR 0 = 0 (true) 0 OR 0 = 1 (false) 0 OR 1 = 0 (true) I realize most true and false in BASIC is -1 for True and 0 for False, but I will use this DLL in other languages such as Actor 4.0 See Also : BitAnd, BitXOr ------------------------- BitXOr --------------------------- Usage : Declare Function BitXOr Lib "BITS.DLL" (ByVal e1%, ByVal e2%) As Integer i% = BitXOr(e1%, e2%) Parameters : Integer e1% - exponent 1, number to XOR Integer e2% - mask, number to XOR against e1% Return Value: Integer - e2% XOR masked against e1% Comments : 1 XOR 1 = 1 (false) 1 XOR 0 = 0 (false) 0 XOR 0 = 1 (true) 0 XOR 1 = 0 (false) Treat XOR like "opposite day" in school, whatever is true under OR is now false ("everything I'm telling you is a lie" ... Harvey Mudd) See Also : BitAnd, BitOr ------------------------- BitShiftLeft --------------------------- Usage : Declare Function BitShiftLeft Lib "BITS.DLL" (ByVal e1%, ByVal e2%) As Integer i% = BitShiftLeft(e1%, e2%) Parameters : Integer e1% - exponent 1, number to shift Integer e2% - amount to shift e1% Return Value: Integer - e1% shifted by the amount of e2% Comments : This is an excellent operation for FAST multiplication and/or division ! See Also : ByteHigh, BitShiftRight ------------------------- BitShiftLeft --------------------------- Usage : Declare Function BitShiftLeft Lib "BITS.DLL" (ByVal e1%, ByVal e2%) As Integer i% = BitShiftLeft(e1%, e2%) Parameters : Integer e1% - exponent 1, number to shift Integer e2% - amount to shift e1% Return Value: Integer - e1% shifted by the amount of e2% Comments : This is an excellent operation for FAST multiplication and/or division ! See Also : ByteHigh, BitShiftLeft